package org.mech.sefer.client.ui.task.executor;

import org.apache.pivot.util.concurrent.Task;
import org.mech.sefer.client.ui.task.TaskConfig;
import org.mech.sefer.client.ui.task.callback.TaskCallback;

/**
 * <p>
 * The TaskExecutor is task executor
 * </p>
 * <p>
 * Date: 25.4.2012 8:40:05
 * </p>
 * 
 * @author martin.krajc
 */
public interface TaskExecutor {

	/**
	 * Execute task with given callback
	 * 
	 * @param <T>
	 *            the generic type of task result
	 * @param task
	 *            the task
	 * @param callback
	 *            the callback for task
	 */
	<T> void execute(Task<T> task, TaskCallback<T> callback);

	/**
	 * Execute the task. Task config serves only as wrapper interface
	 * {@link #execute(Task, TaskCallback)} should be called anyway.
	 * 
	 * @param <T>
	 *            the generic type of task result
	 * @param taskConfig
	 *            the task config
	 */
	<T> void execute(TaskConfig<T> taskConfig);
}
